package com.ibeeking.found.report.rest.controller.v1;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ibeeking.found.report.rest.service.IReportManageService;
import com.ibeeking.found.report.service.common.query.ReportManagePageQuery;
import com.ibeeking.found.report.service.common.vo.SimpleJimuReportVO;
import com.ibeeking.found.report.service.common.vo.SimpleReportVO;
import com.ibeeking.nematos.constants.enums.OperateLogTypeEnum;
import com.ibeeking.nematos.log.annotation.Log;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @ClassName ReportManageController
 * @Description
 * @Author ibeeking
 * @Date 2021-06-02 18:15
 **/
@RestController
@RequestMapping("/reportManage/v1")
public class ReportManageController {

    @Resource
    private IReportManageService reportManageServiceImpl;

    @Log(logType = OperateLogTypeEnum.QUERY, describe = "大屏报表分页列表")
    @PostMapping(value = "/dmpPageList")
    public Page<SimpleReportVO> dmpPageList(@RequestBody ReportManagePageQuery pageQuery) {
        return reportManageServiceImpl.dmpPageList(pageQuery);
    }

    @Log(logType = OperateLogTypeEnum.MODIFY, describe = "大屏报表状态修改")
    @GetMapping(value = "/changeDmpStatus/{id}/{status}")
    public Boolean changeDmpStatus(@PathVariable("id") Long id, @PathVariable("status") Integer status) {
        return reportManageServiceImpl.changeDmpStatus(id, status);
    }

    @Log(logType = OperateLogTypeEnum.DEL, describe = "大屏报表删除")
    @GetMapping(value = "/delDmpReport/{id}")
    public Boolean delDmpReport(@PathVariable("id") Long id) {
        return reportManageServiceImpl.delDmpReport(id);
    }

    @Log(logType = OperateLogTypeEnum.QUERY, describe = "查询报表分页列表")
    @PostMapping(value = "/jmPageList")
    public Page<SimpleJimuReportVO> jmPageList(@RequestBody ReportManagePageQuery pageQuery) {
        return reportManageServiceImpl.jmPageList(pageQuery);
    }

    @Log(logType = OperateLogTypeEnum.MODIFY, describe = "查询报表状态修改")
    @GetMapping(value = "/changeJmStatus/{id}/{status}")
    public Boolean changeJmStatus(@PathVariable("id") String id, @PathVariable("status") Integer status) {
        return reportManageServiceImpl.changeJmStatus(id, status);
    }

    @Log(logType = OperateLogTypeEnum.DEL, describe = "查询报表删除")
    @GetMapping(value = "/delJmReport/{id}")
    public Boolean delJmReport(@PathVariable("id") String id) {
        return reportManageServiceImpl.delJmReport(id);
    }

    @Log(logType = OperateLogTypeEnum.QUERY, describe = "查询报表域地址")
    @GetMapping(value = "/jimuReportServer")
    public String jimuReportServer() {
        return reportManageServiceImpl.getJimuReportServerDomain();
    }

}
